package com.situ.day4;

//extends: 继承
public class Student extends Person {
//    private int id;
//    private String name;
//    private int age;
    private String className;

    //Java里面new子类对象时候首先把父类对象new出来。
    public Student() {
        //super();//new Person()
    }

    public Student(int id, String name, int age, String className) {
        super(id, name, age); // new Person(id, name, age)
//        super();
//        this.id = id;
//        this.name = name;
//        this.age = age;
        this.className = className;
    }

    public void show() {
        System.out.println("Student.show");
    }

    public void study() {
        System.out.println(name + "正在"+className+"学习");
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    @Override
    public String toString() {
        return "Student{" +
                "className='" + className + '\'' +
                ", id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
